/**
 * @author lonun
 * @blog http://www.lonun.com
 */

var config = require('./config');
var Controller = function (appName, controller, action){
	this.action = action;
	this.controller = controller;
	this.appName = appName;
	this.url = null;
	var tempViewPath = this.appName.substring(0, this.appName.lastIndexOf("app"))+config.templatePath+"/"+this.controller+"/"+this.action+config.templateSuffix[config.templateType];
	console.log(tempViewPath);
	this.viewPath = tempViewPath;
	this.params = {};
}
Controller.prototype.getAppName = function(){return this.appName;};
Controller.prototype.getControllerName = function(){return this.controller;};
Controller.prototype.getActionName = function(){return this.action;};
Controller.prototype.setUrl = function(url){this.url = url;};
Controller.prototype.getViewPath = function(){return this.viewPath;};
Controller.prototype.addParam = function(key, value){this.params[key]=value;};
Controller.prototype.addAllParam = function(obj){
	for(var key in obj){
		this.params[key] = obj[key];
	}
};
exports.Controller = Controller;